<?php
namespace hc;
/**
* author hc;
*/
class cookie{
	//开启cookie
	public static function set($name,$value,$time=false){
		$config=C('cookie');
		if($time){
			$config['expire']=$time;
		}
		$value=encode($value);
	   return setcookie($name,$value,time()+$config['expire'], $config['path'], $config['domain']);
	}
	//获取cookie
	public static function get($name){
		if(isset($_COOKIE[$name])){
	         $value=$_COOKIE[$name];
	         return decode($value);
	    }else{
			return false;
		}
	}
	//删除cookie
	public static function del($name){
		$config=C('cookie');
		return setcookie($name, '', time()-3600, $config['path'], $config['domain']);
	}
}
?>